<?php

require_once  "h2c.class.php";
//require_once  "Http.class2.php";

Class Page{

	private $url;
	private $wpost;
	private $host;
	public  $html;
    public  $utf8;
    private $temp;
	
	function __autoload() {
	    
	    
	}

	
	function Page($str,$cookies="",$haveReferer=1,$isutf8=0){
		if(substr($str,0,4)=="http"){

			if($cookies!=""){
preg_match_all("/http\:\/\/([^<>\s\/]*)(\/[^<>\s]*)$/Uisx",$str,$nn);
$host=$nn[1][0];
$suburl=$nn[2][0];
$referer=($haveReferer)?"\r\nReferer: http://{$host}/":"";
$cookies=(trim($cookies)!="")?"\r\nCookie: {$cookies}":"";

$poststr="GET {$suburl} HTTP/1.1
Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/QVOD, application/QVOD, */*{$referer}
Accept-Language: zh-CN
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; Foxy/1; QQDownload 702; GTB7.2; Foxy/1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C)
Accept-Encoding: gzip, deflate
Host: {$host}
Proxy-Connection: Keep-Alive
Pragma: no-cache{$cookies}




";	
//echo $poststr;

		    $temp=curl($poststr,$cookies,$haveReferer);
			}else{
				$temp=zq($str);
			}
		}else{
				//echo $str;
				$temp=curl($str);
		}
		$temp=str_replace("\\x26","&",$temp);
		$temp=str_replace("\\x3e",">",$temp);
		$temp=str_replace("\\x3c","<",$temp);
		
		if($isutf8=="1"){
			//$temp=iconv("UTF-8","GB2312//IGNORE",$temp);
		}

		$this->html=$temp;		
	

	}
	
	
	function setUtf8($utf8=0){
		$this->utf8=$utf8;
	}
	
	
	
}


?>
